testsuite: Setup tests env by platform
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 3 Aug 2020 08:14:36 +0000 (16:14 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 5 Aug 2020 08:23:14 +0000 (16:23 +0800)
Check whether we really have x11 and wayland enabled before we try to setup the
tests to use these respective GDK backends, and only attempt to setup tests
running with the Broadway backend if it has been enabled.

Also, add a setup for running tests with the GDK-Win32 backend on Windows, for
builds that target Windows.

testsuite/meson.build

index 03a04048bd46ff94626788b276955e8929ac67de..4ef7cced9a0e8eba1d64db6aa7144b135e0beef1 100644 (file)
@@ -18,24 +18,39 @@ if get_option('debug')
   common_env += [ 'GDK_DEBUG=default-settings' ]
 endif
 
-add_test_setup ('x11',
-                env: common_env + [
-                     'GDK_BACKEND=x11',
-                     'TEST_OUTPUT_SUBDIR=x11',
-                     ])
-
-add_test_setup ('wayland',
-                is_default: true,
-                env: common_env + [
-                      'GDK_BACKEND=wayland',
-                      'TEST_OUTPUT_SUBDIR=wayland',
-                      ])
-
-add_test_setup ('broadway',
-                env: common_env + [
-                      'GDK_BACKEND=broadway',
-                      'TEST_OUTPUT_SUBDIR=broadway',
-                      ])
+if x11_enabled
+  add_test_setup ('x11',
+                  env: common_env + [
+                       'GDK_BACKEND=x11',
+                       'TEST_OUTPUT_SUBDIR=x11',
+                       ])
+endif
+
+if wayland_enabled
+  add_test_setup ('wayland',
+                  is_default: true,
+                  env: common_env + [
+                        'GDK_BACKEND=wayland',
+                        'TEST_OUTPUT_SUBDIR=wayland',
+                        ])
+
+endif
+
+if os_win32
+  add_test_setup ('win32',
+                  env: common_env + [
+                        'GDK_BACKEND=win32',
+                        'TEST_OUTPUT_SUBDIR=win32',
+                        ])
+endif
+
+if broadway_enabled
+  add_test_setup ('broadway',
+                  env: common_env + [
+                        'GDK_BACKEND=broadway',
+                        'TEST_OUTPUT_SUBDIR=broadway',
+                        ])
+endif
 
 subdir('performance')
 subdir('gdk')